local gen = {
    [4] = {
        {1, 2, 3, 4, 5, 6, 9, 13},
        {1, 2, 3, 4, 5, 6, 10, 14},
        {1, 2, 3, 4, 7, 8, 11, 15},
        {1, 2, 3, 4, 7, 8, 12, 16},
        {1, 2, 5, 6, 7, 8, 9, 13},
        {1, 2, 5, 6, 7, 8, 10, 14},
        {3, 4, 5, 6, 7, 8, 11, 15},
        {3, 4, 5, 6, 7, 8, 12, 16},
        {1, 5, 9, 10, 11, 12, 13, 14},
        {2, 6, 9, 10, 11, 12, 13, 14},
        {3, 7, 9, 10, 11, 12, 15, 16},
        {4, 8, 9, 10, 11, 12, 15, 16},
        {1, 5, 9, 10, 13, 14, 15, 16},
        {2, 6, 9, 10, 13, 14, 15, 16},
        {3, 7, 11, 12, 13, 14, 15, 16},
        {4, 8, 11, 12, 13, 14, 15, 16}
    },
    [6] = {
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 19, 25, 31},
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 20, 26, 32},
        {1, 2, 3, 4, 5, 6, 33, 7, 9, 8, 15, 21, 27},
        {1, 2, 3, 4, 5, 6, 34, 10, 11, 12, 16, 22, 28},
        {1, 2, 3, 4, 5, 6, 35, 10, 11, 12, 17, 23, 29},
        {1, 2, 3, 4, 5, 6, 36, 10, 11, 12, 18, 24, 30},
        {1, 2, 3, 7, 8, 9, 10, 11, 12, 13, 19, 25, 31},
        {1, 2, 3, 7, 8, 9, 10, 11, 12, 14, 20, 26, 32},
        {33, 1, 3, 2, 7, 8, 9, 10, 11, 12, 15, 21, 27},
        {34, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 22, 28},
        {35, 4, 5, 6, 7, 8, 9, 10, 11, 12, 17, 23, 29},
        {36, 4, 6, 7, 8, 9, 10, 11, 12, 5, 18, 24, 30},
        {1, 7, 13, 14, 15, 16, 17, 18, 19, 20, 21, 25, 31},
        {2, 8, 13, 14, 15, 16, 17, 18, 19, 20, 21, 26, 32},
        {33, 3, 9, 13, 14, 15, 16, 17, 18, 19, 20, 21, 27},
        {34, 4, 10, 13, 14, 15, 16, 17, 18, 22, 23, 24, 28},
        {35, 5, 11, 13, 14, 15, 16, 17, 18, 22, 23, 24, 29},
        {36, 6, 12, 13, 14, 15, 16, 17, 18, 22, 23, 24, 30},
        {1, 7, 13, 14, 15, 19, 20, 21, 22, 23, 24, 25, 31},
        {2, 8, 13, 14, 15, 19, 20, 21, 22, 23, 24, 26, 32},
        {33, 3, 9, 13, 14, 15, 19, 20, 21, 22, 23, 24, 27},
        {34, 4, 10, 16, 17, 18, 19, 20, 21, 22, 23, 24, 28},
        {35, 5, 11, 16, 17, 18, 19, 20, 21, 22, 23, 24, 29},
        {36, 6, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 30},
        {1, 33, 7, 13, 19, 25, 26, 27, 28, 29, 30, 31, 32},
        {33, 2, 8, 14, 20, 25, 26, 27, 28, 29, 30, 31, 32},
        {33, 3, 9, 15, 21, 25, 26, 27, 28, 29, 30, 31, 32},
        {34, 35, 4, 36, 10, 16, 22, 25, 26, 27, 28, 29, 30},
        {34, 35, 36, 5, 11, 17, 23, 25, 26, 27, 28, 29, 30},
        {34, 35, 36, 6, 12, 18, 24, 25, 26, 27, 28, 29, 30},
        {33, 34, 35, 36, 1, 7, 13, 19, 25, 26, 27, 31, 32},
        {33, 34, 35, 36, 2, 8, 14, 20, 25, 26, 27, 31, 32},
        {33, 34, 35, 36, 3, 9, 15, 21, 25, 26, 27, 31, 32},
        {33, 34, 35, 36, 4, 10, 16, 22, 28, 29, 30, 31, 32},
        {33, 34, 35, 36, 5, 11, 17, 23, 28, 29, 30, 31, 32},
        {33, 34, 35, 36, 6, 12, 18, 24, 28, 29, 30, 31, 32}
    },
    [9] = {
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 73, 19, 20, 21, 28, 37, 46, 55, 64},
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 65, 74, 19, 20, 21, 29, 38, 47, 56},
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 66, 75, 19, 20, 21, 30, 39, 48, 57},
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 67, 76, 13, 14, 15, 22, 23, 24, 31, 40, 49, 58},
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 68, 13, 14, 15, 77, 22, 23, 24, 32, 41, 50, 59},
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 69, 13, 14, 15, 78, 22, 23, 24, 33, 42, 51, 60},
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 70, 79, 16, 17, 18, 25, 26, 27, 34, 43, 52, 61},
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 71, 16, 17, 18, 80, 25, 26, 27, 35, 44, 53, 62},
        {1, 2, 3, 4, 5, 6, 7, 8, 9, 72, 16, 17, 18, 81, 25, 26, 27, 36, 45, 54, 63},
        {1, 2, 3, 73, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 28, 37, 46, 55, 64},
        {1, 2, 3, 65, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 29, 38, 47, 74, 56},
        {1, 2, 3, 66, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 30, 39, 48, 75, 57},
        {67, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 76, 22, 23, 24, 31, 40, 49, 58},
        {4, 5, 6, 68, 10, 11, 12, 13, 14, 15, 16, 17, 18, 77, 22, 23, 24, 32, 41, 50, 59},
        {4, 5, 6, 69, 10, 11, 12, 13, 14, 15, 16, 17, 18, 78, 22, 23, 24, 33, 42, 51, 60},
        {70, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 79, 25, 26, 27, 34, 43, 52, 61},
        {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 80, 25, 26, 27, 71, 35, 44, 53, 62},
        {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 81, 25, 26, 27, 36, 72, 45, 54, 63},
        {1, 2, 3, 73, 10, 11, 12, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 37, 46, 55, 64},
        {1, 2, 3, 65, 10, 11, 12, 74, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 38, 47, 56},
        {1, 2, 3, 66, 10, 11, 12, 75, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 39, 48, 57},
        {67, 4, 5, 6, 76, 13, 14, 15, 19, 20, 21, 22, 23, 24, 25, 26, 27, 31, 40, 49, 58},
        {4, 5, 6, 68, 13, 14, 15, 77, 19, 20, 21, 22, 23, 24, 25, 26, 27, 32, 41, 50, 59},
        {4, 5, 6, 69, 13, 14, 15, 78, 19, 20, 21, 22, 23, 24, 25, 26, 27, 33, 42, 51, 60},
        {70, 7, 8, 9, 79, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 34, 43, 52, 61},
        {7, 8, 9, 71, 80, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 35, 44, 53, 62},
        {7, 8, 9, 72, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 81, 36, 45, 54, 63},
        {1, 73, 10, 19, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 46, 47, 48, 55, 64},
        {65, 2, 74, 11, 20, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 46, 47, 48, 56},
        {66, 3, 75, 12, 21, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 46, 47, 48, 57},
        {67, 4, 76, 13, 22, 28, 29, 30, 31, 32, 33, 34, 35, 36, 40, 41, 42, 49, 50, 51, 58},
        {68, 5, 77, 14, 23, 28, 29, 30, 31, 32, 33, 34, 35, 36, 40, 41, 42, 49, 50, 51, 59},
        {69, 6, 78, 15, 24, 28, 29, 30, 31, 32, 33, 34, 35, 36, 40, 41, 42, 49, 50, 51, 60},
        {70, 7, 79, 16, 25, 28, 29, 30, 31, 32, 33, 34, 35, 36, 43, 44, 45, 52, 53, 54, 61},
        {71, 8, 80, 17, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 43, 44, 45, 52, 53, 54, 62},
        {72, 9, 81, 18, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 43, 44, 45, 52, 53, 54, 63},
        {1, 73, 10, 19, 28, 29, 30, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 55, 64},
        {65, 2, 74, 11, 20, 28, 29, 30, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 56},
        {66, 3, 75, 12, 21, 28, 29, 30, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 57},
        {67, 4, 76, 13, 22, 31, 32, 33, 37, 38, 39, 40, 41, 42, 43, 44, 45, 49, 50, 51, 58},
        {68, 5, 77, 14, 23, 31, 32, 33, 37, 38, 39, 40, 41, 42, 43, 44, 45, 49, 50, 51, 59},
        {69, 6, 78, 15, 24, 31, 32, 33, 37, 38, 39, 40, 41, 42, 43, 44, 45, 49, 50, 51, 60},
        {70, 7, 79, 16, 25, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 52, 53, 54, 61},
        {71, 8, 80, 17, 26, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 52, 53, 54, 62},
        {72, 9, 81, 18, 27, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 52, 53, 54, 63},
        {1, 73, 10, 19, 28, 29, 30, 37, 38, 39, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 64},
        {65, 2, 74, 11, 20, 28, 29, 30, 37, 38, 39, 46, 47, 48, 49, 50, 51, 52, 53, 54, 56},
        {66, 3, 75, 12, 21, 28, 29, 30, 37, 38, 39, 46, 47, 48, 49, 50, 51, 52, 53, 54, 57},
        {67, 4, 76, 13, 22, 31, 32, 33, 40, 41, 42, 46, 47, 48, 49, 50, 51, 52, 53, 54, 58},
        {68, 5, 77, 14, 23, 31, 32, 33, 40, 41, 42, 46, 47, 48, 49, 50, 51, 52, 53, 54, 59},
        {69, 6, 78, 15, 24, 31, 32, 33, 40, 41, 42, 46, 47, 48, 49, 50, 51, 52, 53, 54, 60},
        {70, 7, 79, 16, 25, 34, 35, 36, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 61},
        {71, 8, 80, 17, 26, 34, 35, 36, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 62},
        {72, 9, 81, 18, 27, 34, 35, 36, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 63},
        {1, 65, 66, 73, 10, 74, 75, 19, 28, 37, 46, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64},
        {65, 2, 66, 73, 74, 11, 75, 20, 29, 38, 47, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64},
        {65, 66, 3, 73, 74, 75, 12, 21, 30, 39, 48, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64},
        {67, 4, 68, 69, 76, 13, 77, 78, 22, 31, 40, 49, 55, 56, 57, 58, 59, 60, 61, 62, 63},
        {67, 68, 5, 69, 76, 77, 14, 78, 23, 32, 41, 50, 55, 56, 57, 58, 59, 60, 61, 62, 63},
        {67, 68, 69, 6, 76, 77, 78, 15, 24, 33, 42, 51, 55, 56, 57, 58, 59, 60, 61, 62, 63},
        {70, 7, 71, 72, 79, 16, 80, 81, 25, 34, 43, 52, 55, 56, 57, 58, 59, 60, 61, 62, 63},
        {70, 71, 8, 72, 79, 80, 17, 81, 26, 35, 44, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63},
        {70, 71, 72, 9, 79, 80, 81, 18, 27, 36, 45, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63},
        {1, 65, 66, 67, 68, 69, 70, 71, 72, 10, 73, 74, 75, 19, 28, 37, 46, 55, 56, 57, 64},
        {65, 2, 66, 67, 68, 69, 70, 71, 72, 73, 11, 74, 75, 20, 29, 38, 47, 55, 56, 57, 64},
        {65, 66, 3, 67, 68, 69, 70, 71, 72, 73, 74, 12, 75, 21, 30, 39, 48, 55, 56, 57, 64},
        {65, 66, 67, 4, 68, 69, 70, 71, 72, 76, 13, 77, 78, 22, 31, 40, 49, 58, 59, 60, 64},
        {65, 66, 67, 68, 5, 69, 70, 71, 72, 76, 77, 14, 78, 23, 32, 41, 50, 58, 59, 60, 64},
        {65, 66, 67, 68, 69, 6, 70, 71, 72, 76, 77, 78, 15, 24, 33, 42, 51, 58, 59, 60, 64},
        {65, 66, 67, 68, 69, 70, 7, 71, 72, 79, 16, 80, 81, 25, 34, 43, 52, 61, 62, 63, 64},
        {65, 66, 67, 68, 69, 70, 71, 8, 72, 79, 80, 17, 81, 26, 35, 44, 53, 61, 62, 63, 64},
        {65, 66, 67, 68, 69, 70, 71, 72, 9, 79, 80, 81, 18, 27, 36, 45, 54, 61, 62, 63, 64},
        {1, 65, 66, 73, 10, 74, 75, 76, 77, 78, 79, 80, 81, 19, 28, 37, 46, 55, 56, 57, 64},
        {65, 2, 66, 73, 74, 11, 75, 76, 77, 78, 79, 80, 81, 20, 29, 38, 47, 55, 56, 57, 64},
        {65, 66, 3, 73, 74, 75, 12, 76, 77, 78, 79, 80, 81, 21, 30, 39, 48, 55, 56, 57, 64},
        {67, 4, 68, 69, 73, 74, 75, 76, 13, 77, 78, 79, 80, 81, 22, 31, 40, 49, 58, 59, 60},
        {67, 68, 5, 69, 73, 74, 75, 76, 77, 14, 78, 79, 80, 81, 23, 32, 41, 50, 58, 59, 60},
        {67, 68, 69, 6, 73, 74, 75, 76, 77, 78, 15, 79, 80, 81, 24, 33, 42, 51, 58, 59, 60},
        {70, 7, 71, 72, 73, 74, 75, 76, 77, 78, 16, 79, 80, 81, 25, 34, 43, 52, 61, 62, 63},
        {70, 71, 8, 72, 73, 74, 75, 76, 77, 78, 79, 17, 80, 81, 26, 35, 44, 53, 61, 62, 63},
        {70, 71, 72, 9, 73, 74, 75, 76, 77, 78, 79, 80, 18, 81, 27, 36, 45, 54, 61, 62, 63}
    }
}

local function lazy(size)
    local mt = {
        __index = function(t, k)
            local ret = {}
            for _, v in pairs(gen[size][k]) do
                ret[v] = true
            end
            rawset(t, k, ret)
            return ret
        end
    }
    return setmetatable({}, mt)
end

local runtime = {
    [4] = lazy(4),
    [6] = lazy(6),
    [9] = lazy(9)
}

local M = {
    LIST = gen,
    MAP = runtime
}

return M